package com.pms.privilege.permission.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.pms.privilege.permission.dao.PermissionDAO;
import com.pms.privilege.permission.model.PermUserFuncModel;
import com.pms.privilege.permission.model.PermissionModel;

@Service
public class PermissionService {
	@Autowired
	private PermissionDAO dao;
	/**
	 * 按功能id查询权限列表
	 * @param func_id
	 * @param start
	 * @param end
	 * @return
	 */
	public List<PermUserFuncModel> permListService(long func_id,int start,int end){
		List<PermUserFuncModel> list=new ArrayList<PermUserFuncModel>();
		list=dao.queryPermByFuncID(func_id, start, end);
		return list;
		
	}
	/**
	 * 添加权限
	 * @param pm
	 * @return
	 */
	public int insertPermService(PermissionModel pm){
		dao.insertPermission(pm);
		return 0;
	}
	/**
	 * 更新权限
	 * @param pm
	 * @return
	 */
	public int updatePermService(PermissionModel pm){
		dao.updatePermission(pm);
		return 0;
		
	}
	/**
	 * 删除权限
	 * @param perm_id
	 * @return
	 */
	public int deletePermService(String perm_id){
		dao.deletePermission(perm_id);
		return 0;
	}

}
